<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>

<f:view>

	<a4j:keepAlive beanName="facebookImportBean"/>

    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title>EvIn | Contacts</title>
            <link rel="stylesheet" href="/EvIn/styles/styles.css" type="text/css" />

			<script type="text/javascript">
				function goToResult(){
					var f=document.forms['go_to_contacts'];
					f.submit();
				}
			</script>

        </head>

        <body>

            <div id="wrapper">
                <div class="header">
                    <jsp:include page="/common/header.jsp"></jsp:include>
                </div>
                <div class="fullpane">
                    <div class="leftpane">
                        <jsp:include page="/common/main_menu.jsp"></jsp:include>
                    </div>

                    <div class="rightpane">

                        <div class="contentTitle">
							Facebook contacts
                        </div>
                        <br/>

						<a4j:form id="facebook_contacts_form">
							<rich:dataTable align="center" style="text-align:center;width:100%" id="contacts_table" value="#{facebookImportBean.facebookContacts}" var="contact" ajaxKeys="">
								<rich:column sortBy="#{contact.email}" >
									<f:facet name="header"><h:outputText value="Email"/></f:facet>
									<h:inputText value="#{contact.email}"/>
								</rich:column>
								<rich:column sortBy="#{contact.lastName}" >
									<f:facet name="header"><h:outputText value="Last Name"/></f:facet>
									<h:inputText value="#{contact.lastName}"/>
								</rich:column>
								<rich:column sortBy="#{contact.firstName}" >
									<f:facet name="header"><h:outputText value="First Name"/></f:facet>
									<h:inputText value="#{contact.firstName}"/>
								</rich:column>
								<rich:column>
									<f:facet name="header"><h:outputText value="Action"/></f:facet>
									<a4j:commandLink
										value="Save"
										reRender="contacts_table"
										>
										<f:setPropertyActionListener value="#{contact}" target="#{facebookImportBean.saveContact}"/>
									</a4j:commandLink>
								</rich:column>
							</rich:dataTable>
						</a4j:form>
                    </div>
                </div>
            </div>
        </body>
    </html>

</f:view>

